<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="//cdn.bootcss.com/sockjs-client/1.1.1/sockjs.min.js"></script>
    <script src="//cdn.bootcss.com/stomp.js/2.3.3/stomp.min.js"></script>
    <script src="//cdn.bootcss.com/jquery/2.1.2/jquery.min.js"></script>
</head>
<body>


<script>
    $(function () {

        var socket = null;
        var stompClient = null;
        function connectSocket() {
            socket = new SockJS('/socket');
            stompClient = Stomp.over(socket);
            stompClient.connect({}, function (frame) {
                console.info(frame);
                subscribeTopic();
            });
        }

        function subscribeTopic() {
            stompClient.subscribe('/topic/notice', function (data) {
                alert(data);
            });
        }

        connectSocket();


    });

</script>

</body>
</html>